package com.wanpinghui.supplier.object;

import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.wanpinghui.supplier.R;
import com.wanpinghui.supplier.common.BaseActivity;
import com.wanpinghui.supplier.utils.ActivityJumpUtil;
import com.wanpinghui.supplier.widgets.TitlePanelLayout;
import com.yunshl.yunshllibrary.manager.MActivityManager;
import com.yunshl.yunshllibrary.utils.TextUtil;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;

/***
 * 功能描述:
 * 作者:qiujialiu
 * 时间:2017/12/29
 ***/
@ContentView(R.layout.layout_activity_feedback_result)
public class FeedbackResultActivity extends BaseActivity {
    @ViewInject(R.id.tpl_title)
    private TitlePanelLayout mLayoutTitle;
    @ViewInject(R.id.tv_title)
    private TextView textViewTitle;
    @ViewInject(R.id.tv_object_desception)
    private TextView textViewDescep;
    @ViewInject(R.id.tv_go_detail)
    private TextView textViewDetail;
    @ViewInject(R.id.tv_go_list)
    private TextView textViewGoList;

    private long demandId;
    private String title;

    @Override
    public String getName() {
        return null;
    }

    @Override
    public boolean isBar() {
        return false;
    }

    @Override
    public void initViews() {
        if (getIntent() != null) {
            title = getIntent().getStringExtra("title");
            String desc = getIntent().getStringExtra("desception");
            demandId = getIntent().getLongExtra("id", 0);
            textViewDescep.setText(desc);
        }
        if (TextUtil.isNotEmpty(title)) {
            textViewTitle.setText(title);
        }

    }

    @Override
    public void bindEvents() {
        mLayoutTitle.setOnClickBacktrack(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        textViewDetail.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MActivityManager.getInstance().delACT(FeedBackActivity.class);
                MActivityManager.getInstance().delACT(FeedBackConfirmActivity.class);
                MActivityManager.getInstance().delACT(ObjectDetailActivity.class);
                Intent intent = new Intent(FeedbackResultActivity.this, ObjectDetailActivity.class);
                intent.putExtra("id", demandId);
                startActivity(intent);
                finish();
            }
        });

        textViewGoList.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MActivityManager.getInstance().delACT(FeedBackConfirmActivity.class);
                MActivityManager.getInstance().delACT(FeedBackActivity.class);
                MActivityManager.getInstance().delACT(ObjectDetailActivity.class);
                MActivityManager.getInstance().delACT(ObjectListActivity.class);
                ActivityJumpUtil.startObjectList(FeedbackResultActivity.this);
            }
        });
    }

    @Override
    public void initData() {

    }
}
